<%--
  Created by IntelliJ IDEA.
  User: yh570
  Date: 2022/5/4
  Time: 23:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../base.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${basePath}/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="${basePath}/css/public.css" media="all" type="text/css">
    <style>
        body{
            margin: 10px 0 0 0 !important;
        }
    </style>
</head>
<body>
<div class="layuimini-container">

    <div class="layuimini-main">

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

    </div>
</div>
<script src="${basePath}/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'table','element'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            element=layui.element;
        ;

        table.render({
            elem: '#currentTableId',
            url: 'scoreList/data',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print'],
            cols: [[
                {field: 'account', title: '学号'},
                {field: 'realname', title: '姓名'},
                {field: 'name', title: '课程名'},
                {field: 'usualscore', title: '平时分数（占比70%）', sort: true},
                {field: 'testscore', title: '考试分数（占比30%）', sort: true},
                {field: 'score', title: '课程总分', sort: true}
            ]],
            limits: [2,5,10,15,20],
            limit: 10,
            page: true,
            skin: 'line',
            parseData:function (res){
                var result;
                if(this.page.curr){
                    result = res.data.slice(this.limit*(this.page.curr-1),this.limit*this.page.curr);
                }else{
                    result = res.data.slice(0,this.limit);
                }
                return{
                    "code":res.code,
                    "msg":res.msg,
                    "count":res.count,
                    "data":result
                };
            }
        });
    });
</script>

</body>
</html>